/* ============================================================================
   Prism — design tokens (single source of truth).
   Light values on :root; dark values on .bstem (set pre-paint by the head boot,
   toggled by $store.theme). base/components reference ONLY these vars — never
   literal colors/sizes. Generate a new theme by changing VALUES, not names.

   themeOverrides → token map (per-page themeOverrides / the compiler write these):
     accent→--c-accent   accentInk→--c-accent-ink   bg→--c-bg   surface→--c-surface
     text→--c-text   textMuted→--c-text-muted   border→--c-border   radius→--radius-md
     cardMin→--card-min   containerMax→--container-max   fontBase→--font-base   fontHead→--font-head
   ============================================================================ */
:root{
  /* ── color (light) ── */
  --c-bg:#f4f5f7;
  --c-surface:#ffffff;
  --c-surface-2:#eef0f3;
  --c-text:#1a1d24;
  --c-text-muted:#6b7280;
  --c-border:#e5e7eb;
  --c-accent:#2563eb;
  --c-accent-ink:#ffffff;
  --c-success:#16a34a;
  --c-danger:#e11d48;
  --c-overlay:rgba(15,18,26,.6);

  /* ── typography ── */
  --font-base:'Inter','Noto Sans SC','Noto Sans TC',system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif;
  --font-head:var(--font-base);
  --fs-xs:clamp(.72rem,.69rem + .12vw,.8rem);
  --fs-sm:clamp(.82rem,.78rem + .2vw,.9rem);
  --fs-md:clamp(.95rem,.9rem + .25vw,1.05rem);
  --fs-lg:clamp(1.12rem,1rem + .55vw,1.4rem);
  --fs-xl:clamp(1.4rem,1.15rem + 1.1vw,2.05rem);
  --fs-2xl:clamp(1.8rem,1.35rem + 2.2vw,2.9rem);
  --lh-tight:1.22;
  --lh-base:1.6;

  /* ── spacing (fluid) ── */
  --space-xs:clamp(.25rem,.22rem + .15vw,.4rem);
  --space-sm:clamp(.5rem,.44rem + .3vw,.75rem);
  --space-md:clamp(.85rem,.7rem + .7vw,1.25rem);
  --space-lg:clamp(1.25rem,1rem + 1.4vw,2rem);
  --space-xl:clamp(2rem,1.5rem + 2.6vw,3.5rem);
  --section-gap:clamp(1.5rem,1.1rem + 2vw,3rem);

  /* ── radius ── */
  --radius-sm:6px;
  --radius-md:12px;
  --radius-lg:18px;
  --radius-pill:999px;

  /* ── layout ── */
  --container-max:1280px;
  --card-min:clamp(120px,14vw,180px);   /* drives repeat(auto-fill, minmax(--card-min,1fr)) */
  --col-gap:var(--space-md);

  /* ── elevation ── */
  --shadow-1:0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.1);
  --shadow-2:0 4px 12px rgba(16,24,40,.08),0 2px 4px rgba(16,24,40,.06);
  --shadow-3:0 12px 32px rgba(16,24,40,.16);

  /* ── motion ── */
  --ease:cubic-bezier(.4,0,.2,1);
  --dur:.2s;

  color-scheme:light;
}

/* ── dark (html.bstem; mirrored to body by prism.js) ── */
.bstem{
  --c-bg:#0f1115;
  --c-surface:#171a21;
  --c-surface-2:#1f232c;
  --c-text:#e6e8ee;
  --c-text-muted:#9aa3b2;
  --c-border:#2a2f3a;
  --c-accent:#3b82f6;
  --c-accent-ink:#ffffff;
  --c-success:#22c55e;
  --c-danger:#fb7185;
  --c-overlay:rgba(0,0,0,.66);
  --shadow-1:0 1px 2px rgba(0,0,0,.4);
  --shadow-2:0 6px 16px rgba(0,0,0,.45);
  --shadow-3:0 14px 36px rgba(0,0,0,.55);
  color-scheme:dark;
}
